The data and R Markdown scripts in this archive replicate the empirical results presented in “Protests and Incumbent Support: Evidence from a Natural Experiment in Ghana”. 

The analyses were run on a MacBook Air, using macOS Sequoia 15.2 and R version 4.2.3 (2023-03-15) // RStudio version 2023.03.0+386. 

Code:
The repository contains two R Markdown files. The first, "protests_CPS.Rmd", contains all code to produce the manuscript and all corresponding figures in their entirety. The second, "protests_CPS_appendix.Rmd", does the same for the online appendix that accompanies the article. 


Data:
All data needded to produce the article's empirical results are in the file "protests_CPS_data.RData". This contains several datasets which are used for distinct analyses, which are summarised below. 

1. Main survey dataset used to produce the main UESD estimates (figures 8 and 11) and related checks (figures 5-7, 10, 12) presented in the article: "data".
2. Afrobarometer data from rounds 7 and 9, used to produce placebo tests (fig 9) and measures of external validity (fig 13): "r7sub", "AB_r9".
3. Data used to produce descriptive figures (1-4), in the main text. This includes the files: "agg_election", "acled_full", "tweets", "trends", "ghana_adm".

There are also a handful of other saved datasets which contain subsets of the main survey and Afrobarometer, aligned to the bandwidths discussed in the article. These contain bandwidth-specific entropy balancing weights and are used to produce the weighted specifications. The bandwidths are 2 days before and after the protest, 3 days, all days excluding the three protest days ("donut"), and all days excluding just the first protest day "fullsample". The specific datasets are:

1. Main survey dataset: data_eb_2days, data_eb_3days, data_eb_fullsample_donut, data_eb_fullsample
2. Main survey dataset for compliance checks in the appendix (section 4.4): data_eb_2days_info, data_eb_3days_info, data_eb_fullsample_donut_info, data_eb_fullsample_info
3. Main survey dataset for alternative outcome checks in the appendix (section 5.1): data_eb_2days_alt, data_eb_3days_alt, data_eb_fullsample_donut_alt, data_eb_fullsample_alt
4. Main survey dataset adjusting weights for constituency vote share, to use in additional checks in appendix (section 4.6): data_eb_2days_con, data_eb_3days_con, data_eb_fullsample_donut_con, data_eb_fullsample_con

Misc:
The file "protests_CPS.bib" is a bibliography file. This is needed to successfully load references when knitting the R Markdown files, but is not necessary to produce empirical results.